<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
    </head>
    <body>
        <script>
            //设置延时执行
            var interValId = setInterval(function(){//将定时器方法赋值给变量interValId
                console.log("杰瑞教育");
            },1000);    

            //5s后清除定时器
            setTimeout(function(){
                clearInterval(interValId);//将声明Interval返回的id，传入clearInterval            },5000);//5s后清除延时器
            },5000);

</script>
</body>

</html>